<template>
  <div id="app">
    <div class="header-container">
      <Header id="Header" v-if="$route.meta.requiresAuth" />
    </div>

    <router-view
      id="Content"
      :style="$route.meta.requiresAuth ? 'padding-top:80px' : ''"
    />
    <Footer v-if="!isMobile" />
    <div class="background">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
</template>
<script>
import Header from '@/components/Header'
import Footer from '@/components/Footer'
import {
  getOpeningModuleList,
  removeOpeningModuleList,
  setOpeningModuleList
} from '@/utils/Storage'
export default {
  components: {
    Header,
    Footer
  },
  computed: {
    // 是否为移动端
    isMobile() {
      return this.$data.isMobile
    }
  },
  mounted() {
    this.initializeCos()

    // 获取以开启的模块开关
    this.getOpeningModuleSwitch()
  },
  methods: {
    // 初始化cos
    initializeCos() {
      this.$store.dispatch('cos/InitializeCos')
    },
    // 获取已开启的模块开关
    async getOpeningModuleSwitch() {
      // 如果已经存储了模块开关
      const res = await this.$API.auth.getOpeningModuleSwitch()
      if (res.status == 200) {
        let moduleList = res.data.map(item => {
          return item.module_name
        })

        // 存储到vuex
        this.$store.commit('paid/SETOPENINGMODULELIST', moduleList)
      }
    }
  }
}
</script> 
<style>
#app {
  width: 100%;
  overflow: auto;
  overflow-x: hidden;
  overflow-y: hidden;
  min-height: 100vh;

  /* position: relative; */
  /* height: auto; */
  background-color: #f4f5f5;
  /* background-color: #efefef; */
}
.header-container {
  position: fixed;
  /* background-color: yellow; */
  left: 0;
  top: 0;
  z-index: 9999;
  width: 100%;
}

#Content {
  /* position: absolute; */
  min-height: 80vh;
  width: 70%;
  margin: 0px auto 20px auto;
  z-index: 1;
  /* min-height: 90vh; */
}
/* 
@keyframes move {
  100% {
    transform: translate3d(0, 0, 1px) rotate(360deg);
  }
}

.background {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  z-index: -999;
  background: #f1f1f1;
  overflow: hidden;
}

.background span {
  width: 50vmin;
  height: 50vmin;
  border-radius: 50vmin;
  backface-visibility: hidden;
  position: absolute;
  animation: move;
  animation-duration: 45;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.background span:nth-child(0) {
  color: #b8fff8;
  top: 50%;
  left: 31%;
  animation-duration: 25s;
  animation-delay: -31s;
  transform-origin: -7vw 9vh;
  box-shadow: -100vmin 0 13.46361184405582vmin currentColor;
}
.background span:nth-child(1) {
  color: #ffacac;
  top: 23%;
  left: 53%;
  animation-duration: 53s;
  animation-delay: -37s;
  transform-origin: 17vw 25vh;
  box-shadow: -100vmin 0 13.345961446828522vmin currentColor;
}
.background span:nth-child(2) {
  color: #ffacac;
  top: 74%;
  left: 83%;
  animation-duration: 26s;
  animation-delay: -8s;
  transform-origin: -15vw -7vh;
  box-shadow: 100vmin 0 13.258773526023262vmin currentColor;
}
.background span:nth-child(3) {
  color: #b8e4ff;
  top: 99%;
  left: 30%;
  animation-duration: 38s;
  animation-delay: -8s;
  transform-origin: 10vw -12vh;
  box-shadow: 100vmin 0 13.113479980398258vmin currentColor;
}
.background span:nth-child(4) {
  color: #b8e4ff;
  top: 95%;
  left: 1%;
  animation-duration: 19s;
  animation-delay: -41s;
  transform-origin: 10vw -15vh;
  box-shadow: 100vmin 0 12.918931116370201vmin currentColor;
}
.background span:nth-child(5) {
  color: #b8fff8;
  top: 77%;
  left: 22%;
  animation-duration: 17s;
  animation-delay: -36s;
  transform-origin: 19vw -9vh;
  box-shadow: 100vmin 0 12.540170622263828vmin currentColor;
}
.background span:nth-child(6) {
  color: #b8fff8;
  top: 93%;
  left: 85%;
  animation-duration: 15s;
  animation-delay: -17s;
  transform-origin: -12vw 25vh;
  box-shadow: 100vmin 0 12.980980489254723vmin currentColor;
}
.background span:nth-child(7) {
  color: #ffacac;
  top: 8%;
  left: 25%;
  animation-duration: 16s;
  animation-delay: -7s;
  transform-origin: -11vw 10vh;
  box-shadow: -100vmin 0 13.334411875064454vmin currentColor;
}
.background span:nth-child(8) {
  color: #b8fff8;
  top: 83%;
  left: 83%;
  animation-duration: 47s;
  animation-delay: -49s;
  transform-origin: -1vw 18vh;
  box-shadow: -100vmin 0 13.38924709535018vmin currentColor;
} */
/* 移动端样式 */
@media screen and (max-width: 767px) {
  #Content {
    /* position: absolute; */

    width: 80%;
    margin: 0px auto 0px auto;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    padding: 0 auto;
  }

  /* 其他移动端样式设置 */
}
</style>
